<template>
  <div class="talk">
    <button @click="getLoveTalk">获取一句土味情话</button>
    <ul>
      <li v-for="talk in talkList" :key="talk.id">{{ talk.title }}</li>
    </ul>
  </div>
</template>

<script setup lang="ts" name="LoveTalk">
import { useTalkStore } from '@/store/loveTalk'
import { storeToRefs } from "pinia";

const talkStore = useTalkStore()
const { talkList } = storeToRefs(talkStore)



// 方法
function getLoveTalk() {
  talkStore.getATalk()
}
</script>

<style scoped>
.talk {
  background: linear-gradient(135deg, #ff7e5f, #feb47b);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
  color: white;
  font-family: 'Arial', sans-serif;
  position: relative;
  overflow: hidden;
}

.talk::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  pointer-events: none;
  z-index: 1;
}

.talk button {
  margin: 10px 5px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background-color: #ff6347;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  z-index: 2;
  position: relative;
}

.talk button:hover {
  background-color: #ff4500;
  transform: scale(1.05);
}

.talk button:active {
  background-color: #3e8e41;
  transform: scale(0.95);
}

.talk ul {
  list-style-type: none;
  padding: 0;
  margin: 20px 0;
}

.talk li {
  background: rgba(255, 255, 255, 0.2);
  padding: 10px;
  margin: 5px 0;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 16px;
  transition: background-color 0.3s;
  z-index: 2;
  position: relative;
}

.talk li:hover {
  background: rgba(255, 255, 255, 0.3);
}
</style>
